Clinical AI Kit home Documentation hub / Human-in-the-Loop Approval

Human-in-the-Loop Approval

The clinical review gate (Day 2b) — a LongRunningFunctionTool pauses the pipeline until a clinician decides. This is the closest process to true BPMN: two lanes, one message flow, one exclusive gateway.

flowchart TD
    subgraph LANE_AGENT["Lane: Agent (capstone_agent)"]
        DONE["Extraction pipeline completes"]
        CONF{confidence >= threshold?}
        AUTO["Auto-approve path"]
        PAUSE["Pause: state = needs_review
(LongRunningFunctionTool)"] PERSIST["persist_extraction_relational
persist_extraction_vector
(require approved receipt)"] DISCARD["Discard + reason logged"] end subgraph LANE_CLIN["Lane: Clinician (Clinical Inbox UI)"] INBOX["Review results in Clinical Inbox"] DECIDE{Approve or Reject?} end DONE --> CONF CONF -->|yes| AUTO --> PERSIST CONF -->|no| PAUSE --> INBOX --> DECIDE DECIDE -->|approve
transition: needs_review -> approved| PERSIST DECIDE -->|reject
transition: needs_review -> rejected| DISCARD PERSIST --> END1([Stored to relational + vector stores]) DISCARD --> END2([Audit event with rejection reason])

Key facts:

Related: Image Extraction Pipeline · Security Layers · Clinical App